""和null的转换问题

来源:百度知道 编辑:UC知道 时间:2024/06/20 14:58:50
我现在在sqlserver2005用存储过程实现表A的数据转到表B里,如果表A的一个字段为空,要求在表B里面显示为null,有很多字段是空的,所以不能逐一判断。在线急等,谢谢!

你看下下边的这个可以不?
SQL SERVER 2000可以。

create procedure nulltospace
as

update B set B.timeis null where B.id=A.id and B.time ='';
update B set B.liqis null where B.id=A.id and B.liq ='';
update B set B.oilis null where B.id=A.id and B.oil ='';
update B set B.wateris null where B.id=A.id and B.water ='';
update B set B.fwis null where B.id=A.id and B.fw ='';
update B set B.sectionis null where B.id=A.id and B.section ='';

GO